<?php

namespace app\admin\model\member;

use think\Model;


class Actrelacc extends Model
{

    

    

    // 表名
    protected $table = 'activity_participants';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'type_text',
    ];



    //新加类型字段
    public function getTypeList()
    {
        return ['2' => __('type 2'),'1' => __('type 1')];
    }
    //获取状态字段
    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : $data['type'];
        $list = $this->getTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }






    public function account()
    {
        return $this->belongsTo('app\admin\model\Account', 'account_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
